var P = Object.defineProperty, T = Object.defineProperties
var Y = Object.getOwnPropertyDescriptors
var K = Object.getOwnPropertySymbols
var z = Object.prototype.hasOwnProperty, J = Object.prototype.propertyIsEnumerable
var M = (n, e, t) => e in n ? P(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, w = (n, e) => {
  for (var t in e || (e = {})) z.call(e, t) && M(n, t, e[t])
  if (K) for (var t of K(e)) J.call(e, t) && M(n, t, e[t])
  return n
}, C = (n, e) => T(n, Y(e))
const Z = 'BAFEDIHGLKJONMRQPUTSXWVaZYdcbgfejihmlkponsrqvutyxw10z432765+98/C', _ = 1647532800, q = '1.8.0'
let N

function B (n) {
  let e = ''
  const t = (f, p, s) => {
    const r = ((c, v) => {
      const E = c.length - v
      if (E <= 0) return c
      const y = new Array(c.length)
      for (let g = 0; g < c.length; g++) g < v ? y[g] = c[E + g] : y[g] = c[g - v]
      return y
    })(f.split(''), s).join(''), u = []
    let m = 0
    for (; m < r.length;) {
      let c = m + p
      c > r.length && (c = r.length)
      const v = r.substring(m, c)
      u.push(v.split('').reverse().join('')), m = c
    }
    return u.join('')
  }, o = n.indexOf('='), a = n.substring(0, o), A = n.substring(o), i = (t(a, 12, 3) + A).replace(/[^A-Za-z0-9\+\/\=]/g, ''), l = t(Z, 3, 1) + '='
  let d, h, k, L, O, S, j, x = 0
  for (; x < i.length;) L = l.indexOf(i.charAt(x++)), O = l.indexOf(i.charAt(x++)), S = l.indexOf(i.charAt(x++)), j = l.indexOf(i.charAt(x++)), d = L << 2 | O >> 4, h = (O & 15) << 4 | S >> 2, k = (S & 3) << 6 | j, e = e + String.fromCharCode(d), S != 64 && (e = e + String.fromCharCode(h)), j != 64 && (e = e + String.fromCharCode(k))
  return e = (f => {
    let p = '', s = 0, r = 0, u = 0, m = 0
    for (; s < f.length;) r = f.charCodeAt(s), r < 128 ? (p += String.fromCharCode(r), s++) : r > 191 && r < 224 ? (u = f.charCodeAt(s + 1), p += String.fromCharCode((r & 31) << 6 | u & 63), s += 2) : (u = f.charCodeAt(s + 1), m = f.charCodeAt(s + 2), p += String.fromCharCode((r & 15) << 12 | (u & 63) << 6 | m & 63), s += 3)
    return p
  })(e), e
}

function D (n) {
  var t
  if (typeof n != 'string') return { code: 1 }
  const e = B(n)
  try {
    const o = JSON.parse(e), a = o.version
    if (a && a !== q) return { code: 2 }
    const A = o.expiration
    if (A && A < _) return { code: 2 }
    const b = o.domain
    if (b) {
      const i = (t = window == null ? void 0 : window.location) == null ? void 0 : t.hostname
      if (!i) return C(w({}, o), { code: 3 })
      if (i === 'localhost' || i === '127.0.0.1') return C(w({}, o), { code: 4 })
      const l = b.split('.'), d = i.split('.')
      for (let h = l.length - 1; h >= 0; h--) if (l[h] !== d[h]) return C(w({}, o), { code: 3, hostname: i })
      if (d.length > l.length && d[d.length - l.length - 1] !== 'www') return C(w({}, o), { code: 3, hostname: i })
    }
    return C(w({}, o), { code: 4 })
  } catch {}
  return { code: 1 }
}

function F () {
  return !0
}

function G (n) {N = n}

export const checkLicense = F
export const setLicense = G
